<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This file documents the use of the GNU compilers.

Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>S/390 System z Built-in Functions (Using the GNU Compiler Collection (GCC))</title>

<meta name="description" content="S/390 System z Built-in Functions (Using the GNU Compiler Collection (GCC))">
<meta name="keywords" content="S/390 System z Built-in Functions (Using the GNU Compiler Collection (GCC))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Indices.html" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Target-Builtins.html" rel="up" title="Target Builtins">
<link href="SH-Built_002din-Functions.html" rel="next" title="SH Built-in Functions">
<link href="RX-Built_002din-Functions.html" rel="prev" title="RX Built-in Functions">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
kbd.key {font-style: normal}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>


</head>

<body lang="en_US">
<div class="subsection-level-extent" id="S_002f390-System-z-Built_002din-Functions">
<div class="nav-panel">
<p>
Next: <a href="SH-Built_002din-Functions.html" accesskey="n" rel="next">SH Built-in Functions</a>, Previous: <a href="RX-Built_002din-Functions.html" accesskey="p" rel="prev">RX Built-in Functions</a>, Up: <a href="Target-Builtins.html" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="S_002f390-System-z-Built_002din-Functions-1"><span>6.60.31 S/390 System z Built-in Functions<a class="copiable-link" href="#S_002f390-System-z-Built_002din-Functions-1"> &para;</a></span></h4>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fbuiltin_005ftbegin"><span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tbegin</strong> <code class="def-code-arguments">(void*)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftbegin"> &para;</a></span></dt>
<dd><p>Generates the <code class="code">tbegin</code> machine instruction starting a
non-constrained hardware transaction.  If the parameter is non-NULL the
memory area is used to store the transaction diagnostic buffer and
will be passed as first operand to <code class="code">tbegin</code>.  This buffer can be
defined using the <code class="code">struct __htm_tdb</code> C struct defined in
<code class="code">htmintrin.h</code> and must reside on a double-word boundary.  The
second tbegin operand is set to <code class="code">0xff0c</code>. This enables
save/restore of all GPRs and disables aborts for FPR and AR
manipulations inside the transaction body.  The condition code set by
the tbegin instruction is returned as integer value.  The tbegin
instruction by definition overwrites the content of all FPRs.  The
compiler will generate code which saves and restores the FPRs.  For
soft-float code it is recommended to used the <code class="code">*_nofloat</code>
variant.  In order to prevent a TDB from being written it is required
to pass a constant zero value as parameter.  Passing a zero value
through a variable is not sufficient.  Although modifications of
access registers inside the transaction will not trigger an
transaction abort it is not supported to actually modify them.  Access
registers do not get saved when entering a transaction. They will have
undefined state when reaching the abort code.
</p></dd></dl>

<p>Macros for the possible return codes of tbegin are defined in the
<code class="code">htmintrin.h</code> header file:
</p>
<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-_005fHTM_005fTBEGIN_005fSTARTED"><span class="category-def">Macro: </span><span><strong class="def-name">_HTM_TBEGIN_STARTED</strong><a class="copiable-link" href="#index-_005fHTM_005fTBEGIN_005fSTARTED"> &para;</a></span></dt>
<dd><p><code class="code">tbegin</code> has been executed as part of normal processing.  The
transaction body is supposed to be executed.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-_005fHTM_005fTBEGIN_005fINDETERMINATE"><span class="category-def">Macro: </span><span><strong class="def-name">_HTM_TBEGIN_INDETERMINATE</strong><a class="copiable-link" href="#index-_005fHTM_005fTBEGIN_005fINDETERMINATE"> &para;</a></span></dt>
<dd><p>The transaction was aborted due to an indeterminate condition which
might be persistent.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-_005fHTM_005fTBEGIN_005fTRANSIENT"><span class="category-def">Macro: </span><span><strong class="def-name">_HTM_TBEGIN_TRANSIENT</strong><a class="copiable-link" href="#index-_005fHTM_005fTBEGIN_005fTRANSIENT"> &para;</a></span></dt>
<dd><p>The transaction aborted due to a transient failure.  The transaction
should be re-executed in that case.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-_005fHTM_005fTBEGIN_005fPERSISTENT"><span class="category-def">Macro: </span><span><strong class="def-name">_HTM_TBEGIN_PERSISTENT</strong><a class="copiable-link" href="#index-_005fHTM_005fTBEGIN_005fPERSISTENT"> &para;</a></span></dt>
<dd><p>The transaction aborted due to a persistent failure.  Re-execution
under same circumstances will not be productive.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-_005fHTM_005fFIRST_005fUSER_005fABORT_005fCODE"><span class="category-def">Macro: </span><span><strong class="def-name">_HTM_FIRST_USER_ABORT_CODE</strong><a class="copiable-link" href="#index-_005fHTM_005fFIRST_005fUSER_005fABORT_005fCODE"> &para;</a></span></dt>
<dd><p>The <code class="code">_HTM_FIRST_USER_ABORT_CODE</code> defined in <code class="code">htmintrin.h</code>
specifies the first abort code which can be used for
<code class="code">__builtin_tabort</code>.  Values below this threshold are reserved for
machine use.
</p></dd></dl>

<dl class="first-deftp">
<dt class="deftp" id="index-struct-_005f_005fhtm_005ftdb"><span class="category-def">Data type: </span><span><strong class="def-name">struct __htm_tdb</strong><a class="copiable-link" href="#index-struct-_005f_005fhtm_005ftdb"> &para;</a></span></dt>
<dd><p>The <code class="code">struct __htm_tdb</code> defined in <code class="code">htmintrin.h</code> describes
the structure of the transaction diagnostic block as specified in the
Principles of Operation manual chapter 5-91.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fbuiltin_005ftbegin_005fnofloat"><span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tbegin_nofloat</strong> <code class="def-code-arguments">(void*)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftbegin_005fnofloat"> &para;</a></span></dt>
<dd><p>Same as <code class="code">__builtin_tbegin</code> but without FPR saves and restores.
Using this variant in code making use of FPRs will leave the FPRs in
undefined state when entering the transaction abort handler code.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fbuiltin_005ftbegin_005fretry"><span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tbegin_retry</strong> <code class="def-code-arguments">(void*, int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftbegin_005fretry"> &para;</a></span></dt>
<dd><p>In addition to <code class="code">__builtin_tbegin</code> a loop for transient failures
is generated.  If tbegin returns a condition code of 2 the transaction
will be retried as often as specified in the second argument.  The
perform processor assist instruction is used to tell the CPU about the
number of fails so far.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fbuiltin_005ftbegin_005fretry_005fnofloat"><span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tbegin_retry_nofloat</strong> <code class="def-code-arguments">(void*, int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftbegin_005fretry_005fnofloat"> &para;</a></span></dt>
<dd><p>Same as <code class="code">__builtin_tbegin_retry</code> but without FPR saves and
restores.  Using this variant in code making use of FPRs will leave
the FPRs in undefined state when entering the transaction abort
handler code.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fbuiltin_005ftbeginc"><span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_tbeginc</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftbeginc"> &para;</a></span></dt>
<dd><p>Generates the <code class="code">tbeginc</code> machine instruction starting a constrained
hardware transaction.  The second operand is set to <code class="code">0xff08</code>.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fbuiltin_005ftend"><span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tend</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftend"> &para;</a></span></dt>
<dd><p>Generates the <code class="code">tend</code> machine instruction finishing a transaction
and making the changes visible to other threads.  The condition code
generated by tend is returned as integer value.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fbuiltin_005ftabort"><span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_tabort</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftabort"> &para;</a></span></dt>
<dd><p>Generates the <code class="code">tabort</code> machine instruction with the specified
abort code.  Abort codes from 0 through 255 are reserved and will
result in an error message.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fbuiltin_005ftx_005fassist"><span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_tx_assist</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftx_005fassist"> &para;</a></span></dt>
<dd><p>Generates the <code class="code">ppa rX,rY,1</code> machine instruction.  Where the
integer parameter is loaded into rX and a value of zero is loaded into
rY.  The integer parameter specifies the number of times the
transaction repeatedly aborted.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fbuiltin_005ftx_005fnesting_005fdepth"><span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tx_nesting_depth</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftx_005fnesting_005fdepth"> &para;</a></span></dt>
<dd><p>Generates the <code class="code">etnd</code> machine instruction.  The current nesting
depth is returned as integer value.  For a nesting depth of 0 the code
is not executed as part of an transaction.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fbuiltin_005fnon_005ftx_005fstore"><span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_non_tx_store</strong> <code class="def-code-arguments">(uint64_t *, uint64_t)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnon_005ftx_005fstore"> &para;</a></span></dt>
<dd>
<p>Generates the <code class="code">ntstg</code> machine instruction.  The second argument
is written to the first arguments location.  The store operation will
not be rolled-back in case of an transaction abort.
</p></dd></dl>

</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="SH-Built_002din-Functions.html">SH Built-in Functions</a>, Previous: <a href="RX-Built_002din-Functions.html">RX Built-in Functions</a>, Up: <a href="Target-Builtins.html">Built-in Functions Specific to Particular Target Machines</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
